package com.zq.behavior.visitor;

public interface Visitor {
    void visitConcreteElementA(ConcreteElementA element);
    void visitConcreteElementB(ConcreteElementB element);
}

class ConcreteVisitor implements Visitor {
    @Override
    public void visitConcreteElementA(ConcreteElementA element) {
        System.out.println("Visitor has visited " + element.getClass().getSimpleName());
    }

    @Override
    public void visitConcreteElementB(ConcreteElementB element) {
        System.out.println("Visitor has visited " + element.getClass().getSimpleName());
    }
}
